<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@include file="./common/header.jsp" %>
<body>
<%@ include file="./common/top.jsp"%>
	<div class="container">
		
		<form class="form-horizontal" role="form" id="brands_form_id">
		  <input type="hidden" name="id" id="id_id">

		  <div class="form-group">
		    <label class="col-sm-2 control-label">调整难度：</label>
		    <div class="col-xs-3">
				<select name="hard" id="hard_id" class="form-control">
					<option value="0" >正常</option>
					<option value="1">困难</option>
					<option value="2">非常困难</option>
					<option value="3">变态难</option>
				</select>
		    </div>
		  </div>
		  
		  <div class="form-group">
		    <div class="col-sm-offset-2 col-sm-10">
	    	  <button type="button" id="add_brands_btn_id" class="btn btn-primary">修改</button>
		      <a href="./customerList.jsp" class="btn btn-default">取消</a>
		    </div>
  		  </div>
  		</form>
  		
	</div>
	<script>
		
		
		$(function(){
			var valid = new jValidation.Validation('brands_form_id',{immediate:true},{onSubmit:false});
			$('#add_brands_btn_id').click(
				function(){
					var result = valid.validate();
					if(!result){
						return;
					}
					var formData = $('#brands_form_id').serialize();
					jQuery.ajax( {
						type : 'POST',
						url : '../admin/customer/setHard.do',
						dataType : 'json',
						data : formData,
						success : function(obj) {
							if(obj.result){
								window.top.jWei.Tips.success("调整难度成功");
								location.href="./customerList.jsp";
							}else{
								window.top.jWei.Tips.success(obj.errorMsg);
							}
						},
						error : function() {
							alert('error');
						}
					});
				}		
			);
			
			var id = $.request.queryString["id"];
			jQuery.ajax( {
				type : 'Get',
				url : '../admin/customer/get.do',
				dataType : 'json',
				contentType : 'application/json',
				data : {
					id: id
				},
				success : function(obj) {
					if(obj.result){
						$("#id_id").val(obj.obj.id);
						$("#hard_id").val(obj.obj.hard);
					}else{
						alert(obj.errorMsg);
					}
				},
				error : function() {
					alert('error');
				}
			});

		});
		
		
	</script>
</body>
</html>